<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no" />
    <!-- import CSS -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <style>
        .el-row {
            margin-bottom: 20px;
    
            &:last-child {
                margin-bottom: 0;
            }
        }
    
        .el-col {
            border-radius: 4px;
        }
    
        .bg-purple-dark {
            background: #99a9bf;
        }
    
        .bg-purple {
            background: #d3dce6;
        }
    
        .bg-purple-light {
            background: #e5e9f2;
        }
    
        .grid-content {
            border-radius: 4px;
            min-height: 36px;
        }
    
        .row-bg {
            padding: 10px 0;
            background-color: #f9fafc;
        }
    </style>
</head>

<body>
    <div id="app">

        <el-row :gutter="20">
            <el-col :span="6">
                <el-button type="primary" @click="videoList">视频列表</el-button>
            </el-col>
            <el-col :span="6">
                <el-button clas type="primary" @click="videoData">指定视频刷新</el-button>
            </el-col>
        </el-row>

    </div>
</body>
<!-- import Vue before Element -->
<script type="text/javascript" src="../j/api.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function () {
            return { visible: false }
        },
        methods: {
            videoList: function (params) {
                var dyInit = api.require('DouYinPlatform');
                dyInit.auth({ 'scope': 'video.list' }, function (ret) {
                    alert(JSON.stringify(ret))
                    console.log(JSON.stringify(ret))

                    if (ret) {
                        if (ret.code == 0) {
                            // 抖音videoList
                            _ajax1('douyin/videoList', function (ret, err) {

                                console.log(JSON.stringify(ret))

                            }, ret);

                        } else {
                            api.alert({
                                msg: '您取消了抖音授权'
                            });
                            return;
                        }
                    }

                });
            },
            videoData: function (params) {
                var dyInit = api.require('DouYinPlatform');
                dyInit.auth({ 'scope': 'video.data' }, function (ret) {
                    alert(JSON.stringify(ret))
                    console.log(JSON.stringify(ret))

                    if (ret) {
                        if (ret.code == 0) {
                            // 抖音videoData
                            _ajax1('douyin/videoData', function (ret, err) {

                                console.log(JSON.stringify(ret))

                            }, ret);

                        } else {
                            api.alert({
                                msg: '您取消了抖音授权'
                            });
                            return;
                        }
                    }

                });
            }
        }
    })
</script>

</html>